package dca.sistemascontrole.view;

import dca.sistemascontrole.util.ControleConstantes;

/**
 *
 * @author Rafael
 */
public class DialogTanques extends javax.swing.JDialog {

    public DialogTanques(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        lblTanqueSuperior.setText(ControleConstantes.TITULO_TANQUE_SUPERIOR);
        lblTanqueInferior.setText(ControleConstantes.TITULO_TANQUE_INFERIOR);
//        lblTanqueSuperior.setText(ControleConstantes.TITULO_TANQUE_SUPERIOR + " : 0.000 cm");
//        lblTanqueInferior.setText(ControleConstantes.TITULO_TANQUE_INFERIOR + " : 0.000 cm");
    }

    public void setNivelTanqueSuperior(double value) {
        float porcentagemTanqueSuperior = (float) (value / (float) ControleConstantes.ALTURA_TANQUE);
//        lblTanqueSuperior.setText(String.format("%s : %.3f cm", ControleConstantes.TITULO_TANQUE_SUPERIOR, variaveisObservaveis.getNivelTankSuperior()));
        sensorAlturaSuperior.setPorcentagemFluido(porcentagemTanqueSuperior);
        sensorAlturaSuperior.repaint();
    }

    public void setNivelTanqueInferior(double value) {
        float porcentagemTanqueInferior = (float) (value / (float) ControleConstantes.ALTURA_TANQUE);
//        lblTanqueInferior.setText(String.format("%s : %.3f cm", ControleConstantes.TITULO_TANQUE_INFERIOR, variaveisObservaveis.getNivelTankInfeior()));
        sensorAlturaInferior.setPorcentagemFluido(porcentagemTanqueInferior);
        sensorAlturaInferior.repaint();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        sensorAlturaSuperior = new dca.sistemascontrole.view.components.SensorAltura();
        lblTanqueSuperior = new javax.swing.JLabel();
        lblTanqueInferior = new javax.swing.JLabel();
        sensorAlturaInferior = new dca.sistemascontrole.view.components.SensorAltura();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        sensorAlturaSuperior.setBackground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout sensorAlturaSuperiorLayout = new javax.swing.GroupLayout(sensorAlturaSuperior);
        sensorAlturaSuperior.setLayout(sensorAlturaSuperiorLayout);
        sensorAlturaSuperiorLayout.setHorizontalGroup(
            sensorAlturaSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        sensorAlturaSuperiorLayout.setVerticalGroup(
            sensorAlturaSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 207, Short.MAX_VALUE)
        );

        lblTanqueSuperior.setText("Tanquer Superior");

        lblTanqueInferior.setText("Tanquer Inferior");

        sensorAlturaInferior.setBackground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout sensorAlturaInferiorLayout = new javax.swing.GroupLayout(sensorAlturaInferior);
        sensorAlturaInferior.setLayout(sensorAlturaInferiorLayout);
        sensorAlturaInferiorLayout.setHorizontalGroup(
            sensorAlturaInferiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        sensorAlturaInferiorLayout.setVerticalGroup(
            sensorAlturaInferiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 206, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sensorAlturaInferior, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblTanqueSuperior, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblTanqueInferior, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(0, 51, Short.MAX_VALUE))
                    .addComponent(sensorAlturaSuperior, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblTanqueSuperior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sensorAlturaSuperior, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblTanqueInferior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sensorAlturaInferior, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblTanqueInferior;
    private javax.swing.JLabel lblTanqueSuperior;
    private dca.sistemascontrole.view.components.SensorAltura sensorAlturaInferior;
    private dca.sistemascontrole.view.components.SensorAltura sensorAlturaSuperior;
    // End of variables declaration//GEN-END:variables
}
